package controller.cartp;

import com.alibaba.fastjson.JSON;
import com.zuche.framework.tradingPlatform.GroupType;
import com.zuche.framework.tradingPlatform.RequestParams;
import com.zuche.framework.utils.PropertiesReader;
import controller.remote.CartpRemoteClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.Map;

/**司机提现接口
 * Created by 雷霆 on 2016/10/18.
 */
@Controller
public class DriverDrawingController {
    private static final Logger logger = LoggerFactory.getLogger(DriverDrawingController.class);

    private String projectAddress;

    public DriverDrawingController() {
        this.projectAddress = PropertiesReader.getAppointPropertiesAttribute(
                "setting", "projectAddress", String.class);
    }




    @RequestMapping(value = "DriverDrawing.do_",produces = "text/html;charset=utf-8")
    public static  Object doDriverDrawing(){
            //发起cartp提现请求
            Map<String,String> paramMap;
            paramMap = paramCartp();
            logger.error(" [提现]carttp调用参数 : " + JSON.toJSONString(paramMap));
            Map<String,String> resultMap = CartpRemoteClient.doRpcInvoke(paramMap, true);
            logger.error(" [提现]carttp返回结果 : " + JSON.toJSONString(resultMap));

            return null;
    }


    /**
     * 封装cartp参数
     * @return
     */
    public static Map<String,String> paramCartp() {
        Map<String,String> paramMap = new HashMap<String,String>();
        paramMap.put(RequestParams.GROUP_TYPE, GroupType.DRAWING);
        paramMap.put(RequestParams.SOURCE_ID,"PAB");
        paramMap.put(RequestParams.CARD_BANK_NAME,"平安银行");
        paramMap.put(RequestParams.CARD_BANK_CITY,"天津");
        paramMap.put(RequestParams.PAYER_NAME,"郭艳松");
        paramMap.put(RequestParams.CARD_NO,"6230580000073630183");
        paramMap.put(RequestParams.BUSINESS_MONEY,"0.01");
        paramMap.put(RequestParams.BUSINESS_ID, "TX2260256335301");
        paramMap.put(RequestParams.BUSINESS_NAME, "driverDrawing");
        paramMap.put(RequestParams.SYS_GROUP, "8");
        return paramMap;
    }


}
